<template lang="pug">
  myTable(:mySeach="[]"  :tableHeader="tableHeader" :myTableButtons="[]" :myButtons="myButtons" seachMenth="POST" seachUrl="/web/classes/getClassCheckDetail" :otherForm="otherForm")
</template>
<script>
import myTable from '../components/myTable.vue'
import { exportClassCheckDetail } from '@/api/educationalAdminstration'
import { getToken } from '@/utils/auth'
import { downloadXls } from '@/utils'

export default {
  name: 'ClockingIn',
  components: {
    myTable
  },
  data () {
    return {
      ticket: getToken(),
      otherForm: {
        id: this.$route.params.id,
        todayDate: this.$route.params.date,
        className: this.$route.params.name
      },
      dialogVisible: false,
      tableHeader: [
        {
          label: '所属班级',
          prop: 'classesName'
        },
        {
          label: '学生姓名',
          prop: 'childrenName'
        },
        {
          label: '入园考勤',
          prop: 'checkInTime'
        },
        {
          label: '离园考勤',
          prop: 'checkOutTime'
        }
      ],
      myButtons: [
        {
          label: '导出',
          type: 'warning',
          plain: true,
          click: (data) => {
            console.log('data', data)
          }
        }
      ]
    }
  },
  mounted () {
    console.log('classesId', this.otherForm)
    this.myButtons[0].click = (data) => {
      console.log('导出', data)
      this.$confirm('是否导出' + this.otherForm.className + '考勤数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        exportClassCheckDetail({ ticket: this.ticket, pageNum: 0, pageSize: 1000, todayDate: this.otherForm.todayDate, id: this.otherForm.id }).then(res => {
          downloadXls(res, this.otherForm.className + '考勤数据.xlsx')
        })
      })
      // this.$message({
      //   type: 'success',
      //   message: '导出成功!'
      // })
    }
  }
}
</script>

<style scoped lang="scss">

</style>
